home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / BORL_TIP / TI1000 / TI1774.ASC < prev    next >
Text File  |  1994-02-15  |  4KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland Pascal                        NUMBER  :  1774
  9.   VERSION  :  7.0
  10.        OS  :  WIN
  11.      DATE  :  February 15, 1994                        PAGE  :  1/3
  12.  
  13.     TITLE  :  CREATING AN OWL APP WITH NO BORDER AND NO CAPTION
  14.  
  15.  
  16.  
  17.  
  18.   Sometimes programmers of OWL applications want to open a
  19.   main window that has no border, no caption, and which
  20.   fills the entire screen.  The following example shows
  21.   how to do this.
  22.  
  23.   To get started, override the Init Constructor.  Then set
  24.   the Windows style to WS_VISIBLE and WS_POPUP:
  25.  
  26.     Attr.Style := ws_Visible or ws_PopUp;
  27.  
  28.   After doing this, the program will appear with no
  29.   border and no caption.  However, the window will not
  30.   be visible unless you define its size.  To give the
  31.   program a shape, assign it a width and height:
  32.  
  33.     Attr.X := 100;
  34.     Attr.Y := 100;
  35.     Attr.H := 200;
  36.     Attr.W := 200;
  37.  
  38.   Of course, if you want to show the window in a maximized
  39.   state, then you can simply send it a WM_SYSCOMMAND message
  40.   from the programs SETUPWINDOW procedure:
  41.  
  42.     procedure TStepWindow.SetUpWindow;
  43.     begin
  44.       inherited SetUpWindow;
  45.       PostMessage(HWindow, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
  46.     end;
  47.  
  48.   To sum up, the shortest way from point A to point B is to
  49.   first give the window the WS_POPUP style, and then
  50.   maximize it with the WM_SYSCOMMAND message.  If you
  51.   want to create a window that is not maximized, then be
  52.   sure to set the window's width and height.  The example
  53.   below shows a maximized window:
  54.  
  55.  
  56.   program NoCaption;
  57.  
  58.   uses WinTypes, WinProcs, OWindows, Strings;
  59.  
  60.   type
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Borland Pascal                        NUMBER  :  1774
  75.   VERSION  :  7.0
  76.        OS  :  WIN
  77.      DATE  :  February 15, 1994                        PAGE  :  2/3
  78.  
  79.     TITLE  :  CREATING AN OWL APP WITH NO BORDER AND NO CAPTION
  80.  
  81.  
  82.  
  83.  
  84.     PStepWindow = ^TStepWIndow;
  85.     TStepWindow = object(TWindow)
  86.       constructor Init(P: PWindowsObject; AName: PChar);
  87.       procedure SetUpWindow; virtual;
  88.       procedure Paint(PaintDC: HDC; var PaintInfo: TPaintStruct);
  89.         virtual;
  90.       procedure WMLButtonDown(var Msg: TMessage);
  91.         virtual wm_First + wm_LButtonDown;
  92.     end;
  93.  
  94.     TMyApplication = object(TApplication)
  95.       procedure InitMainWindow; virtual;
  96.     end;
  97.  
  98.   constructor TStepWindow.Init(P: PWindowsObject; AName: PChar);
  99.   begin
  100.     inherited Init(P, Aname);
  101.     Attr.Style := ws_Visible or WS_PopUp;
  102.   {  Attr.H := 200;
  103.     Attr.W := 200; }
  104.   end;
  105.  
  106.   procedure TStepWindow.SetUpWindow;
  107.   begin
  108.     inherited SetUpWindow;
  109.     PostMessage(HWindow, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
  110.   end;
  111.  
  112.   procedure TStepWindow.WMLButtonDown(var Msg: TMessage);
  113.   begin
  114.     CloseWindow;
  115.   end;
  116.  
  117.   procedure TStepWindow.Paint(PaintDC: HDC;
  118.                        var PaintInfo: TPaintStruct);
  119.   var
  120.     S: array[0..100] of Char;
  121.   begin
  122.     StrCopy(S, 'Click on Window to close it');
  123.     TextOut(PaintDC, 10, 10, S, StrLen(S));
  124.   end;
  125.  
  126.   procedure TMyApplication.InitMainWindow;
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Borland Pascal                        NUMBER  :  1774
  141.   VERSION  :  7.0
  142.        OS  :  WIN
  143.      DATE  :  February 15, 1994                        PAGE  :  3/3
  144.  
  145.     TITLE  :  CREATING AN OWL APP WITH NO BORDER AND NO CAPTION
  146.  
  147.  
  148.  
  149.  
  150.   begin
  151.     MainWindow := New(PStepWindow, Init(nil, 'Steps'));
  152.   end;
  153.  
  154.   var
  155.     MyApp: TMyApplication;
  156.  
  157.   begin
  158.     MyApp.Init('Steps');
  159.     MyApp.Run;
  160.     MyApp.Done;
  161.   end.
  162.  
  163.  
  164.  
  165.   DISCLAIMER: You have the right to use this technical information
  166.   subject to the terms of the No-Nonsense License Statement that
  167.   you received with the Borland product to which this information
  168.   pertains.
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.